import 'package:h_flutter_119/page/LoginPage.dart';
import 'package:h_flutter_119/page/getx/test/interceptor/page/LoginInterceptorPage.dart';

import 'BaseLoginInterceptorImp.dart';
import 'LoginInterceptChain.dart';

class LoginInterceptor extends BaseLoginInterceptorImp{

  @override
  void interceptor(LoginInterceptChain chain) {
    super.interceptor(chain);

    if(LoginInterceptChain.isLogin()) {
      // 如果已经登录 -> 放行，转交给下一个拦截器
      chain.process();
    }else{
      LoginInterceptorPage.goLoginPage();
    }
  }

  void loginFinished(){
    // 如果登录完成，调用方法放行到下一个拦截器
    mChain?.process();
  }

}